package com.ruoyi.web.controller.tool;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.system.domain.SysDevice;
import com.ruoyi.system.service.ISysDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

@Api("ESM")
@RestController
@RequestMapping("/esm")
public class EsmController extends BaseController
{
    @Autowired
    private ISysDeviceService sysDeviceService;

    @ApiOperation("获取产线列表")
    @GetMapping("/devicelist")
    //http://localhost:8083/esm/devicelist
    public AjaxResult devicelist()
    {
        SysDevice sysDevice = new SysDevice();
        List<SysDevice> list = sysDeviceService.selectSysDeviceList(sysDevice);
        return AjaxResult.success(list);
//        return error("产线无");
    }

    @ApiOperation("获取产线")
    @ApiImplicitParam(name = "deviceId", value = "产线ID", required = true, dataType = "int", paramType = "path")
    @GetMapping("/getdevice/{deviceId}")
    //http://localhost:8083/esm/getdevice/1
    public AjaxResult getdevice(@PathVariable Long deviceId)
    {
        SysDevice sysDevice = sysDeviceService.selectSysDeviceById(deviceId);
        return AjaxResult.success(sysDevice);
    }

}


